package database;

import java.sql.SQLException;
import java.sql.Statement;

public class DbLebensmittelLoeschen {

	private int id;
	
	private int userID;
	
	public boolean loeschen(){
		
		
		DbAllgemein init = new DbAllgemein();		
		Statement stat = init.initialisieren();	//Initialisiert Datenbank

		try{
			stat.execute("DELETE FROM `lebensmittelliste` WHERE `UserID`='" + userID + "' AND `ID`='" + id + "'");
			
		return true;
			
		}
		catch(SQLException e){
			System.out.println("SQL Error");
			System.out.println("SQLException: " + e.getMessage());
			System.out.println("SQLState: " + e.getSQLState());
			System.out.println("VendorError: " + e.getErrorCode());
		}
		init.connectionClose();	
		
		return false;
	}
	
	public int getId() {
		return id;
	}




	public void setId(int id) {
		this.id = id;
	}




	public int getUserID() {
		return userID;
	}




	public void setUserID(int userID) {
		this.userID = userID;
	}

}
